#ifndef APPLICATION_H
#define APPLICATION_H

#include <QApplication>
class MainWindow;
class Document;
class EditorManager;
class AbstractObject;
class CollisionShapesDocument;
class Physics;

class Application : public QApplication
{
    Q_OBJECT
public:
    explicit Application(int &argc, char **argv);

    static Application& app();

    bool initInstance();
    void exitInstance();
    QPointer<MainWindow> mainWindow() const;

    QPointer<Document> createDocument();
    QPointer<Document> loadDocument(const QString& fileName);
    bool saveDocument();
    bool closeDocument();

    QPointer<Document> document() const;
    QPointer<EditorManager> editorManager() const;
    QPointer<CollisionShapesDocument> collisionShapesDocument() const;
    boost::shared_ptr<Physics> physics() const;
private:
    QPointer<MainWindow> m_mainWindow;
    QPointer<Document> m_document;
    QString m_workingFolder;
    QPointer<EditorManager> m_editorManager;
    QPointer<CollisionShapesDocument> m_collisionShapesDocument;
    boost::shared_ptr<Physics> m_physics;
signals:
    void documentClosed();

public slots:
};

#endif // APPLICATION_H
